package com.hurt.competition;

import com.hurt.competition.player.mapper.SysUserMapper;
import com.hurt.competition.player.model.SysUser;
import com.hurt.competition.player.service.SysUserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.List;

@SpringBootApplication
@MapperScan(value = {"com.hurt.competition.player.mapper","com.hurt.competition.admin.mapper","com.hurt.competition.judge.mapper"})
public class CompetitionApplication {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Autowired
    private SysUserService sysUserService;
    public static void main(String[] args) {
        SpringApplication.run(CompetitionApplication.class, args);
    }

    void contextLoads() {
        List<SysUser> sysUsers = sysUserService.list();
        sysUsers.stream().forEach(e-> System.out.println(e));
    }

    void registry(){
        SysUser user = new SysUser();
        user.setUserName("hurt");
        user.setUserPwd("123456");
        SysUser sysUser = sysUserService.insertOrUpdate(user);
        System.out.println(sysUser);
    }

    void login(){
        SysUser user = new SysUser();
        user.setUserName("hurt");
        user.setUserPwd("123456");
        SysUser sysUser = sysUserService.getUserByLogin(user);
        System.out.println(sysUser);
    }

}
